package me.algo.coll2;

/**
 * @author guozheng
 * @date 2024/3/16
 * 先进先出的数据结构
 * 主要方法有：
 * 入队 offer(E)
 * 出队 E poll()
 * 队列大小 size()
 * 队列是否为空 isEmpty()
 */
public class LinkedQueue<E> {

    private transient Node<E> first;
    private transient Node<E> last;
    private transient int size;



    public LinkedQueue() {
        this.size = 0;
    }

    public boolean isEmpty() {
        return size == 0;
    }

    public int getSize() {
        return size;
    }


    static class Node<E> {
        private E ele;
        private Node<E> next;

        private Node<E> prev;

        public E getEle() {
            return ele;
        }

        public void setEle(E ele) {
            this.ele = ele;
        }

        public Node<E> getNext() {
            return next;
        }

        public void setNext(Node<E> next) {
            this.next = next;
        }

        public Node<E> getPrev() {
            return prev;
        }

        public void setPrev(Node<E> prev) {
            this.prev = prev;
        }
    }


}
